package com.xingdata.jjxc.enty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.xingdata.jjxc.utils.StringUtil;
import com.xingdata.jjxc.utils.callback.IJsontoOp;
import com.xingdata.jjxc.utils.database.Column;

public class TestEntity implements ITableEntity, IJsontoOp, Serializable {
	private static final long serialVersionUID = 1L;
	/**
	 * 测试表
	 */
	public static String _TableName = "E_test";
	private String test_ID;
	private String name;

	public String gettest_ID() {
		return test_ID;
	}

	public void settest_ID(String test_ID) {
		this.test_ID = test_ID;
	}

	public String getname() {
		return name;
	}

	public void setname(String name) {
		this.name = name;
	}

	@Override
	public List<Column> GetColumns() {
		List<Column> objColumnList = new ArrayList<Column>();
		Column objColumn = null;

		objColumn = new Column();
		objColumn.setColumnName(ColumnName.test_ID);
		objColumn.setColumnType(ColumnType.String);
		objColumn.setIsAutoIncrement(false);
		objColumn.setIsPrimaryKey(true);
		objColumn.setMaxLength(999999999);
		objColumn.setMinLength(0);
		objColumnList.add(objColumn);

		String[] columnNames = { ColumnName.name };
		for (int i = 0; i < columnNames.length; i++) {
			objColumn = new Column();
			objColumn.setColumnName(columnNames[i]);
			objColumn.setColumnType(ColumnType.String);
			objColumn.setIsAutoIncrement(false);
			objColumn.setIsPrimaryKey(false);
			objColumn.setMaxLength(999999999);
			objColumn.setMinLength(0);
			objColumnList.add(objColumn);
		}
		return objColumnList;
	}

	@Override
	public String GetTableName() {
		return _TableName;
	}

	@Override
	public IJsontoOp GetOb(Map<String, Object> map) {
		TestEntity entity = new TestEntity();
		entity.settest_ID(StringUtil.getData(map, ColumnName.test_ID));
		entity.setname(StringUtil.getData(map, ColumnName.name));
		return entity;
	}

	public class ColumnName {
		public static final String test_ID = "test_ID";
		public static final String name = "name";
	}

}
